home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nibble Magazine
/
nib18.dsk
/
QUICKSORT II DEMO2.bas
< prev
next >
Wrap
BASIC Source File
|
2023-02-26
|
3KB
|
71 lines
1 REM ***********************
2 REM * QUICKSORT II DEMO2 *
3 REM * BY CORNELIS BONGERS *
4 REM * COPYRIGHT (C) 1984 *
5 REM * BY MICROSPARC, INC. *
6 REM * LINCOLN, MA. 01773 *
7 REM ***********************
10 PRINT CHR$(4)"BRUN QUICKSORT II"
20 REM ** MAIN:READ/SORT RECORDS
30 REM **
40 LET NPERS = 11: REM # OF PERSONS
50 LET NVARSPP = 6: REM # OF VARS PER PERSON
60 DIM RECRD$(20): REM RECORDS ARE STORED IN THIS ARRAY
70 DIM FRMT(NVARPP): REM CONTAINS FORMAT VARIABLES
80 FOR I = 1 TO NVARSPP: READ FRMT(I): NEXT
90 LET BLNK$ = " ":BLNK$ = BLNK$ +BLNK$: REM STRING WITH BLANKS
100 HOME : PRINT "** COPYRIGHT 1983 BY MICROSPARC, INC. **": PRINT :MESS$ = "FORMATTING RECORDS": GOSUB 2000
110 FOR I = 1 TO NPERS
120 LET B$ = "":B$ = B$ + RIGHT$(BLNK$ + STR$(I),3): REM INSERT RECORD NUMBER
130 FOR J = 1 TO NVARPP:FRMT = FRMT(J)
140 READ REC$: REM GET DATA
150 REM FORMAT DATA AND ADD TO B$
160 IF FRMT <0 THEN B$ = B$ + LEFT$(REC$ +BLNK$, ABS(FRMT)): GOTO 230
170 LET DEC = INT(.5 +10 *(FRMT - INT(FRMT)))
180 LET REC = VAL(REC$):RIN = INT(REC)
190 IF FRMT = INT(FRMT) THEN C$ = STR$(RIN): GOTO 220
200 LET RFR = REC -RIN:C$ = STR$(RFR): IF NOT RFR THEN C$ = "."
210 LET C$ = STR$(RIN) + LEFT$(C$ +"00",DEC +1)
220 LET B$ = B$ + RIGHT$(BLNK$ +C$, INT(FRMT))
230 NEXT J
240 LET RECRD$(I) = B$
250 NEXT I
260 LET MESS$ = "FORMATTED RECORDS": GOSUB 2000
270 GOSUB 1010
280 & COSRECRD$,1 TO NPERS,(64,15,A,49,15,A,24,20,A,44,5,A,79,8,D,4,20,A)
290 LET MESS$ = "SORTED RECORDS": GOSUB 2000
300 GOSUB 1010
310 & COSRECRD$,1 TO NPERS,(1,3,A)
320 LET MESS$ = "RECORDS RESTORED TO ORIGINAL ORDER": GOSUB 2000
330 GOSUB 1030
340 END
1000 REM **
1010 REM ** PRINT RECORDS
1020 REM **
1030 FOR I = 1 TO NPERS
1040 PRINT RECRD$(I)
1050 NEXT I
1060 RETURN
2000 REM **
2010 REM ** FORMAT DATA
2020 REM **
2030 FOR I = 1 TO 100: NEXT : FOR I = 1 TO 3: PRINT CHR$(7);: NEXT : PRINT
2040 INVERSE : PRINT MESS$: NORMAL : PRINT
2050 RETURN
3000 REM **
3020 REM **
3030 DATA -20,-20,5,-15,-15,8.2
3040 REM **
3050 REM ** DATA NAME/STREET/STREET #/CITY/STATE/DEBT
3060 REM **
3070 DATA SCHOLTEN W.,CAMUSPLEIN,49,ROTTERDAM,ZUID-HOLLAND,1003.23
3080 DATA NELS H.,MERELLAAN,20,CAPELLE,ZUID-HOLLAND,200
3090 DATA MEUL J.,DWARSGRACHT,5,DORDRECHT,ZUID-HOLLAND,50
3100 DATA GRAAF J.,BURGEMEESTER HONDERKOOPWEG,2,HATTEM,GELDERLAND,20
3110 DATA VERSCHOR A.,HERESTRAAT,13,DORDRECHT,ZUID-HOLLAND,30.95
3120 DATA DOMEL J.,BEUKENMEER,28,GOUDERAK,ZUID-HOLLAND,40
3130 DATA VEERVECHT A.,ACHTERSTRAAT,118,POELDIJK,ZUID-HOLLAND,150.80
3140 DATA SCHOLTEN J.,CAMUSPLEIN,49,ROTTERDAM,ZUID-HOLLAND,68
3150 DATA DIDI D.,ASSENWEG,53,ASSEN,DRENTE,12.85
3160 DATA GEILENKERK H.,BOMENLAAN,3,ETTEN,BRABANT,12.78
3170 DATA LAMMERS VAN DER BUER W.,CAMUSPLEIN,5,ROTTERDAM,ZUID-HOLLAND,156.30